package com.eamois.action.sys;

import java.util.Collection;

import com.eamois.action.BaseAction;
import com.eamois.domain.sys.Device;
import com.eamois.domain.sys.DeviceType;
import com.eamois.domain.sys.SubMaterial;
import com.eamois.service.sys.DeviceService;
import com.eamois.service.sys.DeviceTypeService;
import com.eamois.util.ServiceFactory;

public class DeviceAction extends BaseAction{
	private DeviceTypeService deviceTypeService;
	private DeviceService deviceService;
	
	public DeviceAction() {
		deviceTypeService = (DeviceTypeService) ServiceFactory.getInstance().getBean("deviceTypeService");
		deviceService = (DeviceService) ServiceFactory.getInstance().getBean("deviceService");
	}
	
	public Collection<String> findDeviceIds(){
		return this.getDeviceService().findDeviceIds();
	}
	public boolean findDevice(String id){
		return this.getDeviceService().findDevice(id);
	}
	public Device findDeviceById(String id){
		return this.getDeviceService().findDeviceById(id);
	}
	
	public Collection<Device> findDevices(String name,String code,String spec,String model,String remark){
		return this.getDeviceService().findDevice(name, code, spec, model,remark);
	}
	public Collection<DeviceType> findRootDeviceType() {
		return this.getDeviceTypeService().findRootDeviceType();
	}
	public DeviceType findTypeByName(String name) {
		return this.getDeviceTypeService().findTypeByName(name);
	}
	public Collection<DeviceType> findChildDeviceType(DeviceType deviceType) {
		return this.getDeviceTypeService().findChildDeviceType(deviceType);
	}
	
	public void saveDeviceType(DeviceType deviceType) {
		this.getDeviceTypeService().save(deviceType);
	}
	
	public Collection<Device> findDevice(DeviceType deviceType) {
		return this.getDeviceService().findDevice(deviceType);
	}
	
	public Collection<Device> findAllDevice() {
		return this.getDeviceService().findAllDevice();		
	}
	public Collection<Device> findByBelongId(String id){
		return this.getDeviceService().findByBelongId(id);
	}
	public Collection<Device> findDevice(String name,String code,boolean isLike) {
		return this.getDeviceService().findDevice(name, code,isLike);
	}
	public Collection<Device> findDevice(String name,String code,String kind){
		return this.getDeviceService().findDevice(name, code, kind);
	}
	public Collection<Device> findDevice(String name,String code,DeviceType deviceType) {
		return this.getDeviceService().findDevice(name, code, deviceType);
	}
	public Collection<Device> findDevice(String name,String code,String kind,DeviceType deviceType) {
		return this.getDeviceService().findDevice(name, code, kind, deviceType);
	}
	public Collection<Device> findDeviceByNameAndKind(String name,String kind){
		return this.getDeviceService().findDeviceByNameAndKind(name, kind);
	}
	
	public void removeDeviceType(DeviceType deviceType) {
		this.getDeviceTypeService().remove(deviceType);
	}
	
	public void saveDevice(Device device) {
		this.getDeviceService().save(device);
	}
	
	public void removeDevice(Device device) {
		this.getDeviceService().remove(device);
	}
	
	public DeviceTypeService getDeviceTypeService() {
		return deviceTypeService;
	}

	public void setDeviceTypeService(DeviceTypeService deviceTypeService) {
		this.deviceTypeService = deviceTypeService;
	}

	public DeviceService getDeviceService() {
		return deviceService;
	}

	public void setDeviceService(DeviceService deviceService) {
		this.deviceService = deviceService;
	}
	
}
